import unittest,requests


class MyTestCase(unittest.TestCase):
    host='http://10.59.9.18'
    #登陆
    userId=None
    sessionId=None
    def test_1_login(self):
        url=MyTestCase.host+'/health/user/v1/login'
        json={"email":"3500186206@qq.com","pwd":"lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw="}
        r=requests.post(url=url,data=json)
        print(r.json())
        MyTestCase.userId=str(r.json()['result']['userId'])
        MyTestCase.sessionId=r.json()['result']['sessionId']
    #完善用户信息
    def test_2_perfectUserInfo(self):
        url=MyTestCase.host+'/health/user/verify/v1/perfectUserInfo'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"age":19,"height":190,"weight":90}
        r=requests.put(url=url,data=json,headers=headers)
        print(r.json())

    #用户查看自己的档案
    def test_3_findUserArchives(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserArchives'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #用户签到
    def test_4_addSign(self):
        url=MyTestCase.host+'/health/user/verify/v1/addSign'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.post(url=url,headers=headers)
        print(r.json())

    #查询用户当天是否签到
    def test_5_whetherSignToday(self):
        url=MyTestCase.host+'/health/user/verify/v1/whetherSignToday'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #查询用户连续签到天数
    def test_6_findUserSign(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserSign'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #修改用户性别
    def test_7_updateUserSex(self):
        url=MyTestCase.host+'/health/user/verify/v1/updateUserSex'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"sex":1}
        r=requests.put(url=url,data=json,headers=headers)
        print(r.json())

    #修改用户昵称
    def test_8_modifyNickName(self):
        url=MyTestCase.host+'/health/user/verify/v1/modifyNickName'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"nickName":"张三"}
        r=requests.put(url=url,data=json,headers=headers)
        print(r.json())

    #生成邀请码
    def test_9_makeInvitationCode(self):
        url=MyTestCase.host+'/health/user/verify/v1/makeInvitationCode'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.post(url=url,headers=headers)
        print(r.json())

    #查询用户邀请码
    def test_91_findUserInvitationCode(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserInvitationCode'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #修改密码
    def test_92_updateUserPwd(self):
        url=MyTestCase.host+'/health/user/verify/v1/updateUserPwd'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"oldPwd":"123456sa","newPwd":"123456Aa"}
        r=requests.put(url=url,data=json,headers=headers)
        print(r.json())

    #添加用户极光推送信息Token
    def test_93_addUserPushToken(self):
        url=MyTestCase.host+'/health/user/verify/v1/addUserPushToken'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"token":"123456sa"}
        r=requests.post(url=url,data=json,headers=headers)
        print(r.json())

    #token
    def test_94_doTask(self):
        url=MyTestCase.host+'/health/user/verify/v1/doTask'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"taskId":1001}
        r=requests.post(url=url,data=json,headers=headers)
        print(r.json())

    #查询用户任务列表
    def test_95_findUserTaskList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserTaskList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #findUserTaskList
    # def test_96_receiveReward(self):
    #     url=MyTestCase.host+'/health/user/verify/v1/c'
    #     headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
    #     json={"taskId",1001}
    #     r=requests.post(url=url,data=json,headers=headers)
    #     print(r.json())

    #删除用户档案
    def test_96_deleteUserArchives(self):
        url=MyTestCase.host+'/health/user/verify/v1/deleteUserArchives'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"archivesId":1}
        r=requests.delete(url=url,data=json,headers=headers)
        print(r.json())

    #收藏资讯
    def test_97_addInfoCollection(self):
        url=MyTestCase.host+'/health/user/verify/v1/addInfoCollection'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"infoId":1}
        r=requests.post(url=url,data=json,headers=headers)
        print(r.json())

    #查询用户资讯收藏列表
    def test_98_findUserInfoCollectionList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserInfoCollectionList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.post(url=url,params=json,headers=headers)
        print(r.json())

    #取消资讯收藏
    def test_99_cancelInfoCollection(self):
        url=MyTestCase.host+'/health/user/verify/v1/cancelInfoCollection'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"infoId":1}
        r=requests.delete(url=url,params=json,headers=headers)
        print(r.json())

    #收藏病友圈
    def test_991_addUserSickCollection(self):
        url=MyTestCase.host+'/health/user/verify/v1/addUserSickCollection'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"sickCircleId":1}
        r=requests.post(url=url,params=json,headers=headers)
        print(r.json())

    #查询用户收藏病友圈列表
    def test_992_findUserSickCollectionList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserSickCollectionList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #取消病友圈收藏
    def test_993_cancelSickCollection(self):
        url=MyTestCase.host+'/health/user/verify/v1/cancelSickCollection'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"sickCircleId":1}
        r=requests.delete(url=url,params=json,headers=headers)
        print(r.json())

    #用户收藏健康课堂视频列表
    def test_994_findVideoCollectionList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findVideoCollectionList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #用户取消视频收藏
    def test_995_cancelVideoCollection(self):
        url=MyTestCase.host+'/health/user/verify/v1/cancelVideoCollection'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"videoId":1}
        r=requests.delete(url=url,params=json,headers=headers)
        print(r.json())

    #查询用户关注医生列表
    def test_996_findUserDoctorFollowList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserDoctorFollowList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #查询用户购买视频列表
    def test_997_findUserVideoBuyList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserVideoBuyList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #我的钱包
    def test_998_findUserWallet(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserWallet'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #查询用户系统通知列表
    def test_999_findSystemNoticeList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findSystemNoticeList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #查询用户问诊通知列表
    def test_9991_findInquiryNoticeList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findInquiryNoticeList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #查询用户H币通知列表
    def test_9992_findHealthyCurrencyNoticeList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findHealthyCurrencyNoticeList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #绑定（换绑）银行卡信息
    def test_9992_bindUserBankCard(self):
        url=MyTestCase.host+'/health/user/verify/v1/bindUserBankCard'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.post(url=url,params=json,headers=headers)
        print(r.json())

    #查询绑定银行卡信息
    def test_9993_findUserBankCardByUserId(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserBankCardByUserId'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #查询用户身份证信息
    def test_9994_findUserIdCard(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserIdCard'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #查询用户提现记录
    def test_9995_findUserDrawRecordList(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserDrawRecordList'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"page":1,"count":5}
        r=requests.get(url=url,params=json,headers=headers)
        print(r.json())

    #提现
    def test_9996_drawCash(self):
        url=MyTestCase.host+'/health/user/verify/v1/drawCash'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"money":1}
        r=requests.post(url=url,params=json,headers=headers)
        print(r.json())

    #观看资讯奖励
    def test_9997_watchInfoRewards(self):
        url=MyTestCase.host+'/health/user/verify/v1/watchInfoRewards'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"infoId":1}
        r=requests.post(url=url,params=json,headers=headers)
        print(r.json())

    #查询用户未读消息数
    def test_9998_findUserNoticeReadNum(self):
        url=MyTestCase.host+'/health/user/verify/v1/findUserNoticeReadNum'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.get(url=url,headers=headers)
        print(r.json())

    #修改消息状态为全部已读
    def test_9999_modifyAllStatus(self):
        url=MyTestCase.host+'/health/user/verify/v1/modifyAllStatus'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        r=requests.put(url=url,headers=headers)
        print(r.json())

    #绑定人脸
    def test_99991_bindFace(self):
        url=MyTestCase.host+'/health/user/verify/v1/bindFace'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"faceImage":"xxxxxxxx"}
        r=requests.post(url=url,params=json,headers=headers)
        print(r.json())

    #病友圈列表展示
    def test_99992_findSickCircleList(self):
        url=MyTestCase.host+'/health/user/sickCircle/v1/findSickCircleList'
        json={"departmentId":1,"page":1,"count":5}
        r=requests.get(url=url,params=json)
        print(r.json())

    #查询病友圈详情
    def test_99993_findSickCircleInfo(self):
        url=MyTestCase.host+'/health/user/sickCircle/v1/findSickCircleInfo'
        headers={"userId":MyTestCase.userId,"sessionId":MyTestCase.sessionId}
        json={"sickCircleId":2}
        r=requests.get(url=url,headers=headers,params=json)
        print(r.json())

    #根据关键词查询病友圈
    def test_99994_searchSickCircle(self):
        url=MyTestCase.host+'/health/user/sickCircle/v1/searchSickCircle'
        json={"keyWord":"头疼"}
        r=requests.get(url=url,params=json)
        print(r.json())

    #查询病友圈评论列表
    def test_99995_findSickCircleCommentList(self):
        url = MyTestCase.host + '/health/user/sickCircle/v1/findSickCircleCommentList'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"sickCircleId":1,"page": 1, "count": 5}
        r = requests.get(url=url,headers=headers,params=json)
        print(r.json())

    #发表观点
    def test_99996_expressOpinion(self):
        url = MyTestCase.host + '/health/user/sickCircle/verify/v1/expressOpinion'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"commentId": 1, "opinion": 1}
        r = requests.put(url=url, headers=headers, params=json)
        print(r.json())

    #查看我的病友圈发帖列表
    def test_99997_findMySickCircleList(self):
        url = MyTestCase.host + '/health/user/sickCircle/verify/v1/findMySickCircleList'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"commentId": 1, "opinion": 1}
        r = requests.put(url=url, headers=headers, params=json)
        print(r.json())

    #咨询医生
    def test_99998_consultDoctor(self):
        url = MyTestCase.host + '/health/user/inquiry/verify/v1/consultDoctor'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"doctorId": 1}
        r = requests.put(url=url, headers=headers, params=json)
        print(r.json())

    #关注医生
    def test_99999_followDoctor(self):
        url = MyTestCase.host + '/health/user/inquiry/verify/v1/followDoctor'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"doctorId": 1}
        r = requests.post(url=url, headers=headers, params=json)
        print(r.json())

    #取消关注医生
    def test_999991_cancelFollow(self):
        url = MyTestCase.host + '/health/user/inquiry/verify/v1/cancelFollow'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"doctorId": 1}
        r = requests.delete(url=url, headers=headers, params=json)
        print(r.json())

    #用户查看当前问诊
    def test_999992_findCurrentInquiryRecord(self):
        url = MyTestCase.host + '/health/user/inquiry/verify/v1/findCurrentInquiryRecord'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        r = requests.get(url=url, headers=headers)
        print(r.json())

    #查看历史问诊
    def test_999993_findHistoryInquiryRecord(self):
        url = MyTestCase.host + '/health/user/inquiry/verify/v1/findHistoryInquiryRecord'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"page": 1, "count": 5}
        r = requests.get(url=url, params=json, headers=headers)
        print(r.json())

    #查询礼物列表
    def test_999994_findGiftList(self):
        url = MyTestCase.host + '/health/user/inquiry/v1/findGiftList'
        r = requests.get(url=url)
        print(r.json())

    #查询健康讲堂类目
    def test_999995_findVideoCategoryList(self):
        url = MyTestCase.host + '/health/user/video/v1/findVideoCategoryList'
        r = requests.get(url=url)
        print(r.json())

    #发表视频评论（弹幕）
    def test_999996_addVideoComment(self):
        url = MyTestCase.host + '/health/user/video/verify/v1/addVideoComment'
        headers = {"userId": MyTestCase.userId, "sessionId": MyTestCase.sessionId}
        json = {"videoId": 1, "count": "专业"}
        r = requests.post(url=url, data=json, headers=headers)
        print(r.json())

    #banner
    def test_999997_bannersShow(self):
        url = MyTestCase.host + '/health/share/v1/bannersShow'
        r = requests.get(url=url)
        print(r.json())

    #查询科室列表
    def test_999998_bannersShow(self):
        url = MyTestCase.host + '/health/share/knowledgeBase/v1/findDepartment'
        r = requests.get(url=url)
        print(r.json())

    #药品科目分类列表查询
    def test_999999_findDrugsCategoryList(self):
        url = MyTestCase.host + '/health/share/knowledgeBase/v1/findDrugsCategoryList'
        r = requests.get(url=url)
        print(r.json())

    #查询健康资讯板块
    def test_9999991_findDrugsCategoryList(self):
        url = MyTestCase.host + '/health/share/information/v1/findInformationPlateList'
        r = requests.get(url=url)
        print(r.json())

#执行
if __name__ == '__main__':
    unittest.main()
